Publish and Host XML Data Using Tomcat – The Easy Way


Why I missed this easy solution beats me, however, as my team mate Freddy points out in his (e-mail) answer to my comment on his blog about HTTP Filtered Value Sets it is even easier to publish XML data – or any other data – on Tomcat than by creating a web application as described in my last post.

* Update *: See Publishing XML and Other Data With the WAS Liberty Profile for how to do this with the WAS Liberty Profile.

Solution

Basically what you have to do is to publish it in the folder $CATALINA_HOME/webapps/ROOT/. In the context of a Jazz Team Server that is the folder /server/tomcat/webapps/ROOT/. If you have a file test.xml you want to publish on your Tomcat server you can copy it directly into that folder or into a sub folder structure.

Example

To publish the given file makers.xml from the last post as  https://localhost:9443/PEWEnactmentData/makers.xml, assuming a standard Jazz Tomcat deployment.

  • Create a folder PEWEnactmentData in the folder <InstallDir>/server/tomcat/webapps/ROOT/
  • Copy the file makers.xml into the newly created folder

The File is now accessible as https://localhost:9443/PEWEnactmentData/makers.xml as intended. Replace localhost with your fully qualified hostname in your deployment.

Note: Please make sure that your Folder Name does not conflict with the context root of any web application you have deployed on Tomcat.

Summary

Given this approach it is as easy to use Tomcat to maintain your data for HTTP Filtered value providers as using Apache.

This is also a good example how hard it can be to find information in the Internet. I tried to search for publishing XML on Tomcat with what I learned from Freddy, and I did not find an answer to the question really. All the discussions are around deploying applications.

4 thoughts on “Publish and Host XML Data Using Tomcat – The Easy Way

      • Hi Ralph,

        Thanks for the reply i tried with http:/localhost:8888/example_data/makers.xml as suggested but it gave below error-

        Problems accessing ‘http:/localhost:8888/example_data/makers.xml’: URI does not specify a valid host name: http:/localhost:8888/example_data/makers.xml

        Yes, i tried to map localhost to domain name but for that i need to amend the windows host file for which i do not have access. 😦

      • I can’t tell you what the problem is. If you can access the file using a browser. Check the security settings. You sure the protocol is http and not HTTPS?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.